# -*- conding:UTF-8 -*-

'''
@ Project: one-group
@ File: create_app.py
@ Author: 孙博
@ Date：2022/6/8 17:52

'''
from flask import Flask
from models import db
from views.user import user_bp
from flask_cors import CORS
from util.jwt_auth import jwt_authorization


def create_flask_app(config):
    app = Flask(__name__)
    app.config.from_object(config)
    CORS(app)
    db.init_app(app)
    app.register_blueprint(user_bp)
    app.before_request(jwt_authorization)

    return app
